package com.sagframe.sagacity.sqltoy.plus.conditions.eumn;

import com.sagframe.sagacity.sqltoy.plus.conditions.ISqlSegment;

/**
 * sql常用函数
 */
public enum SqlFunctionEnum {

    AVG("AVG", "AVG(%s)"),
    COUNT("COUNT", "COUNT(%s)"),
    SUM("SUM", "SUM(%s)"),
    MIN("MIN", "MIN(%s)"),
    MAX("MAX", "MAX(%s)"),
    DISTINCT("DISTINCT", "DISTINCT(%s)"),
    ;

    private final String keyword;

    private final String sql;

    SqlFunctionEnum(String keyword,String sql) {
        this.keyword = keyword;
        this.sql = sql;
    }

    public String getSqlSegment(String column) {
        return String.format(sql, column);
    }
}
